package com.niiwoo.civet.trade.dao.mapper;

import com.niiwoo.civet.trade.dao.entity.InvestorReceiveRecord;
import com.niiwoo.civet.trade.dto.response.InvestorReceiveResponseDTO;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface InvestorReceiveRecordMapperExt extends InvestorReceiveRecordMapper {

    /**
     * 查询昨日有回款记录的用户发送短信+站内信通知
      * @param receivedDate
     * @return
     */
   List<InvestorReceiveResponseDTO> selectYesterdayInvestorReceiveNotice(@Param("receivedDate") Date receivedDate);

    /**
     * 更新投资用户数据
     * @param investorReceiveRecord
     * @return
     */
   int updateByInvestorUserId(InvestorReceiveRecord investorReceiveRecord);

    /**
     * 根据唯一索引查询通知记录
     * @param investorUserId
     * @param projectId
     * @param receivedDate
     * @return
     */
   InvestorReceiveRecord selectByUniqueIndexForUpdate(@Param("investorUserId") String investorUserId, @Param("projectId")Long projectId,  @Param("receivedDate") Date receivedDate);

    /**
     * 删除回款通知记录
     * @param receivedDate
     * @return
     */
   int deleteByReceivedDate(@Param("receivedDate") Date receivedDate);

    /**
     * 查询用户昨天回款结清笔数
     * @param investorUserId
     * @param receivedDate
     * @return
     */
   Integer selectOverDebtCountByInvestorUserId(@Param("investorUserId") String investorUserId, @Param("receivedDate") Date receivedDate);

}